# 打开百度，搜索“Selenium”
from selenium import webdriver
from selenium.webdriver.common.by import By
import time

driver = webdriver.Chrome()
driver.get("https://www.baidu.com")

# 通过 id 定位搜索框，输入内容
search_box = driver.find_element(By.ID, "chat-input-main")
search_box.send_keys("Selenium")

# 通过 id 定位搜索按钮，点击
search_btn = driver.find_element(By.ID, "chat-submit-button")
search_btn.click()

time.sleep(3)
driver.quit()